package com.sloan.community.common.query;

import lombok.Data;
import lombok.NoArgsConstructor;

import static com.sloan.community.common.Constant.WeightFactor.*;

/**
 * @Author: yaosj
 * @CreateTime: 2024-12-17
 */
@Data
@NoArgsConstructor
public class HotArticleQuery {

    private Double likeCountWeight;

    private Double commentWeight;

    private Double shareCountWeight;

    private Double viewWeight;

    private Double decayRate;

    private Integer limit;


    public HotArticleQuery(Double likeCountWeight, Double commentWeight, Double shareCountWeight,
                           Double viewWeight, Double decayRate, Integer limit) {
        this.likeCountWeight = likeCountWeight;
        this.commentWeight = commentWeight;
        this.shareCountWeight = shareCountWeight;
        this.viewWeight = viewWeight;
        this.decayRate = decayRate;
        this.limit = limit;
    }

    public static HotArticleQuery defaultObj() {
        return new HotArticleQuery(LIKE_COUNT.getWeight(), COMMENT.getWeight(),
                SHARE.getWeight(), SHARE.getWeight(), DECAY_RATE.getWeight(), 10);
    }
}
